<script setup lang="ts">
import { onMounted, computed } from 'vue';
import { useCountDown } from '@vant/use';

const props = defineProps<{
  time: number;
}>();

const countDown = useCountDown({
  time: props.time * 1000,
});

const current = computed(() => countDown.current.value);

onMounted(() => {
  // 开始倒计时
  countDown.start();
});
</script>
<template>
  <div class="countDown">
    <span class="text-sm font-medium">{{ current.days }}</span
    >天 <span class="text-sm font-medium">{{ current.hours }}</span
    >时 <span class="text-sm font-medium">{{ current.minutes }}</span
    >分 <span class="text-sm font-medium">{{ current.seconds }}</span
    >秒
  </div>
</template>
<style lang="less" scoped></style>
